package com.java.netty.common.enums;

public enum MsgType {
    PPTP_CMD_WAITCMD(1),
    PPTP_CMD_NOCMD(2),
    PPTP_CMD_RESET(3),
    PPTP_CMD_ERR(4),
    PPTP_CMD_MSG(5),
    PPTP_CMD_GETENV(6),
    PPTP_CMD_ENV_Q(7),
    PPTP_CMD_ENV_A(8),
    PPTP_CMD_BYE(9),
    PPTP_CMD_REGID_Q(10),
    PPTP_CMD_REGID_A(11),
    PPTP_CMD_REGCH_Q(12),
    PPTP_CMD_REGCH_A(13),
    PPTP_CMD_UNREGCH_Q(14),
    PPTP_CMD_UNREGCH_A(15),
    PPTP_CMD_ACK(16),
    PPTP_CMD_MAX(-1);

    private Integer type;


    private MsgType(Integer type) {
        this.type = type;
    }

    public static MsgType getByValue(Integer type) {
        for (MsgType mType : values()) {
            if (mType.getType().equals(type)) {
                return mType;
            }
        }
        return PPTP_CMD_MAX;
    }

    public Integer getType() {
        return this.type;
    }

    @Override
    public String toString() {
        return "MsgType{" +
                "type=" + type +
                '}';
    }
}
